#include <REGX52.H>

void delay_ms(unsigned int ms)
{
    unsigned int i, j;
    for (i = 0; i < ms; i++)
    {
        for (j = 0; j < 123; j++)
            ;
    }
}

void main()
{
  P2=0xFF;
  while(1)
  {
    if(P3_4==0)
    {delay_ms(50);
        if(P3_4==0)
        {
          while(P3_4==0)
          {}
          P2=P2-1;
        }

    }
    if(P3_7==0)
    {delay_ms(50);
        if(P3_7==0)
        {
          while(P3_7==0)
          {}
          P2=P2+1;
        }

    }
  }
}
